package com.ppc.mapper.employer;

import com.github.pagehelper.Page;
import com.ppc.dto.EmployerClaimPageQueryDTO;
import com.ppc.entity.Claim;
import com.ppc.vo.EmployerClaimDetailVO;
import com.ppc.vo.EmployerClaimMessageVO;
import com.ppc.vo.EmployerClaimQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 申诉mapper
 *
 * @author LENOVO
 * @date 2023/12/20
 */
@Mapper
public interface EmployerClaimMapper {

  /**
   * 雇主分页查询订单申诉
   *
   * @param
   * @return
   */
  Page<EmployerClaimQueryVO> claimPageQuery(EmployerClaimPageQueryDTO employerClaimPageQueryDTO);

  /**
   * 创建申诉
   *
   * @param claim
   */
  void insert(Claim claim);

  /**
   * 查看申诉
   *
   * @param claimId
   * @return {@link EmployerClaimDetailVO}
   */
  EmployerClaimDetailVO check(Long claimId);

  /**
   * 查看申诉消息
   *
   * @param employerId
   * @param userId
   * @return {@link Page}<{@link EmployerClaimMessageVO}>
   */
  Page<EmployerClaimMessageVO> getClaimMessage(Long employerId, Long userId);

  /**
   * 获取通知人id
   *
   * @param taskId
   * @return {@link Long}
   */
  @Select("select worker_id from task where task_id=#{taskId}")
  Long queryNotifyId(Long taskId);

  @Select("select employer_id from task LEFT JOIN requirement re " +
      "on task.require_id = re.require_id where task_id=#{taskId}")
  Long getEmployerIdByTaskId(Long taskId);

}
